"""Maildrop Host Monster xml adapters and setup handlers.
"""
from Products.GenericSetup.utils import XMLAdapterBase
from ely.maildrophostmonster.interfaces import IMaildropHostMonster
from Products.CMFCore.utils import getToolByName
from Products.GenericSetup.utils import exportObjects
from Products.GenericSetup.utils import importObjects
from zope.component import adapts
from Products.GenericSetup.interfaces import ISetupEnviron


class MailHostAdapter(XMLAdapterBase):
    """XML importer and exporter for Maildrop Host Monster.
    """

    __used_for__ = IMaildropHostMonster
    _LOGGER_ID = 'ely.maildrophostmonster'
    name = 'ely.maildrophostmonster'

    adapts(IMaildropHostMonster, ISetupEnviron)


    def _exportNode(self):
        """Export the object as a DOM node.
        """
        node = self._getObjectNode('object')
        self._logger.info('Maildrop Host Monster exported.')
        return node

    def _importNode(self, node):
        """Import the object from the DOM node.
        """
        self._logger.info('Maildrop Host Monster imported.')
